import axios from 'axios'
import { Toast } from 'vant';
import Vue from 'vue'
// import Router from '@/router'
import utils from '@/plugins/urlGet';
Vue.use(Toast).use(utils)
const Http = {}

Http.install = function(Vue, options) {
    // axios.defaults.baseURL = "https://frontinterface.changyuelife.com/"
    
    axios.defaults.baseURL = "https://yjfisvtest.changyuelife.com/"
    axios.interceptors.response.use(function(response) {
        // 对响应数据做点什么
        const status1 = response.data.errcode;
        const status2 =response.data.code;
        const msg = response.data.errmsg;
        if (status1 != "0000"&& status1!='1005'&&status2!='0000'&&status2!='1005') {
            // 提示框
            Toast(msg)
        }
        
        return response;
    }, function(error) {
        // Toast(error)
        // 对响应错误做点什么
        return Promise.reject(error);
    });
    Vue.prototype.$http = axios;

}

export default Http